package ph.com.gs3.formalistics.fragments.views;

import ph.com.gs3.formalistics.R;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class SplashViewFragment extends Fragment {

	private TextView tvMessage;
	private String messageOnQueue;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_splash, container, false);
		tvMessage = (TextView) rootView.findViewById(R.id.splash_tvMessage);

		if (messageOnQueue != null) {
			tvMessage.setText(messageOnQueue);
		}

		return rootView;
	}

	public void setLoadingMessage(String message) {
		if (tvMessage == null) {
			// this fragment is not yet attached, queue the store the message and set it
			// later
			messageOnQueue = message;
		} else {
			tvMessage.setText(message);
		}
	}

}
